package com.isunland.managesystem.adapter;

import android.content.Context;
import android.graphics.Color;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseListAdapter;
import com.isunland.managesystem.entity.CustomerProblemReply;
import com.isunland.managesystem.utils.MyDateUtil;
import java.util.List;

/**
 * Created by Lenovo on 2017/3/1.
 */
//public class CustomerProblemReplyListAdapter <T> extends BaseAdapter {
//
//    private ArrayList<T> objects = new ArrayList<>();
//
//    private Context context;
//    private LayoutInflater layoutInflater;
//
//    public CustomerProblemReplyListAdapter(Context context, ArrayList<T> objects) {
//        this.context = context;
//        this.layoutInflater = LayoutInflater.from(context);
//        this.objects = objects;
//    }
//
//    @Override
//    public int getCount() {
//        return objects.size();
//    }
//
//    @Override
//    public T getItem(int position) {
//        return objects.get(position);
//    }
//
//    @Override
//    public long getItemId(int position) {
//        return position;
//    }
//
//    @Override
//    public View getView(int position, View convertView, ViewGroup parent) {
//        if (convertView == null) {
//            convertView = layoutInflater.inflate(R.layout.adapter_operation_task, parent, false);
//            convertView.setTag(new ViewHolder(convertView));
//        }
//        initializeViews(getItem(position), (ViewHolder) convertView.getTag());
//        return convertView;
//    }
//
//    private void initializeViews(T object, ViewHolder holder) {
//        CustomerProblemReply item = (CustomerProblemReply) object;
//        holder.ivLogo.setVisibility(View.GONE);
//        holder.tvTitle.setText("答复人："+item.getRegStaffName());
//        holder.tvContent.setText("答复时间："+item.getRegDate());
//        holder.tvBottomLeft.setText(item.getReplayContent());
//    }
//
//    static class ViewHolder {
//        @BindView(R.id.iv_logo)
//        ImageView ivLogo;
//        @BindView(R.id.tv_bottomLeft)
//        TextView tvBottomLeft;
//        @BindView(R.id.tv_title)
//        TextView tvTitle;
//        @BindView(R.id.tv_content)
//        TextView tvContent;
//        @BindView(R.id.tv_bottomRight)
//        TextView tvBottomRight;
//
//        ViewHolder(View view) {
//            ButterKnife.bind(this, view);
//        }
//    }
//
//}

public class CustomerProblemReplyListAdapter extends BaseListAdapter<CustomerProblemReply> {

  public CustomerProblemReplyListAdapter(Context context, List<CustomerProblemReply> objects) {
    super(context, objects);
  }

  @Override public void bindData(int position, ViewHolder vh, CustomerProblemReply item) {
    vh.mTitleOneTv.setText(R.string.reply_person);
    vh.mTitleTwoTv.setText(R.string.reply_time);
    vh.mTitleThreeTv.setText(R.string.reply_content);
    vh.mContentOneTv.setText(item.getRegStaffName());
    vh.mContentTwoTv.setText(
        MyDateUtil.parseDateToString(MyDateUtil.stringToDate(item.getRegDate())));
    vh.mContentThreeTv.setText(item.getReplayContent());
    vh.mTitleOneTv.setTextColor(Color.BLACK);
    vh.mContentOneTv.setTextColor(Color.BLACK);
  }
}
